package application;

import java.util.Collection;
import java.util.HashSet;

import neurons.NeuronNet;
import neurons.NeuronNetFactory;
import neurons.NeuronNetFactoryInterface;
import neurons.TooFewHiddenLayersException;

import signal.SignalFactory;
import signal.SignalFactoryInterface;
import synapses.SynapseInterface;
import training.TrainerInterface;
import training.TrainerOr;

public class Application {

	public void startTest1() {

		NeuronNetFactoryInterface netFactory = new NeuronNetFactory();
		NeuronNet netORFunction = netFactory.createMonoLayer(2, 1);

		Collection<SynapseInterface> inSynapses = new HashSet<SynapseInterface>();
		Collection<SynapseInterface> outSynapses = new HashSet<SynapseInterface>();
		inSynapses = netORFunction.getInSynapses();
		outSynapses = netORFunction.getOutSynapses();

		// System.out.println("inSynapses : " + inSynapses.toString());
		// System.out.println("outSynapses : " + outSynapses.toString());

		SignalFactoryInterface signalFactory = new SignalFactory();

		InputDispatcher inputDispatcher = new InputDispatcher(inSynapses);
		TrainerInterface trainerOr = new TrainerOr(inputDispatcher);
		netORFunction.setOutput(trainerOr);
		trainerOr.train();

		// for (SynapseInterface synapseInterface : inSynapses) {
		// synapseInterface.transmit(signalFactory.create(Math.random()));
		// }

	}
}
